Business Rule Types

Finance Rule

Finance business rules are used to generate multidimensional calculations.  These business rules are written as shared business rules and applied to a cube or Member Formulas.  Eight of these can be assigned to run at the cube level during consolidations.

Example APIs:

  • api.FunctionType: Used when special logic needs to be run and a specific process needs to be isolated.

Finance Function Type

  • Calculate: Additional logic during calculation of Entity, Consolidation, Scenario, and Time.  Sets one or more values (left side of formula) equal to another (right side) for a qualified Point of View. This is the most common function used.

  • Translate: Additional logic that uses custom translation.

  • FXRate: Custom logic used to determine foreign exchange rates for any intersection.

  • Consolidate Share: Additional logic used during the custom calculation of the share member.

  • Consolidate Eliminiation: Additional logic used during the custom calculation of the elimination member.

  • Calculation Drill Down Member Formula: Provides custom drill down results.

  • Conditional Input Rule: Makes data cells read-only.  The settings for this can be done directly on the cube, but using a Conditional Input business rule offers more flexibility and allows the use of the cube settings.  This rule can send these returns:

    • ConditionalInputResultType.Default
    • ConditionalInputResultType.NoInput
    • ConditionalInputResultType.NoInputAllowCellDetail
    • ConditionalInputResultType.NoCellDetailAllowInput

    The following business rule example will make all cells for the Account 6000 read-only.  This should be added to a business rule attached to a cube.

    Copy
    Case Is = FinanceFunctionType.ConditionalInput
        If api.Pov.Account.Name.XFEqualsIgnoreCase("6000") Then
            Return ConditionalInputResultType.NoInput
        End If
        Return ConditionalInputResultType.Default   
  • Confirmation Rules: Special logic that runs with confirmation rules.

  • Data Cell: Named GetDataCell calculations that can be reused, for example, a Better/Worse calculation in Cube Views.

  • Dynamic Calc Account: Special logic to use in Dynamic Calc members.

  • Member List and Member List Headers: A custom list of members for use in Cube Views and other areas.

Finance Business Rule Example

Copy

VB.NET

Namespace OneStream.BusinessRule.Finance.CorporateBusinessRules
    Public Class MainClass
        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs) As Object
            Try
                Select Case api.FunctionType
                    Case Is = FinanceFunctionType.Calculate

                        ' Populate Headcount Flow
                        If api.pov.Scenario.name = "Actual" Then

                            api.data.calculate("A#Headcount:F#BegBalHC=A#Headcount:F#None:T#POVPrior1")

                            api.data.calculate("A#Headcount:F#EndBalHC=A#Headcount:F#None")

                            api.data.calculate("A#Headcount:F#CheckHC=A#Headcount:F#BegBalHC+A#Headcount:F#TotalMovementHC-A#Headcount:F#EndBalHC")
                        End If

                        If api.pov.Scenario.name = "Variance" Then
                            api.data.Calculate("F#BudgetEBITDA:A#[EBITDAVar] = A#EBITDA:S#Budget:F#None")
                            api.data.Calculate("F#ActualEBITDA:A#[EBITDAVar] = A#EBITDA:S#Actual:F#None")
                            api.data.Calculate("F#[Bad Debt]:A#[EBITDAVar] = (A#54100:S#Budget:F#None-A#54100:S#Actual:F#None)")

                            api.data.Calculate("F#VarianceCheckSum:A#[EBITDAVar]=F#BudgetEBITDA:A#[EBITDAVar]+F#VarianceEBITDA:A#[EBITDAVar]-F#ActualEBITDA:A#[EBITDAVar]")
                        End If
                End Select

                Return Nothing
            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Function
    End Class
End Namespace

Parser Rule

Parser business rules are used to evaluate and modify field values processed by the Stage Parser Engine as it reads source data. These business rules are written as Shared business rules or logical expressions and applied to a Data Source dimension.

Example API

  • args.Line: Returns the entire record being processed from the data source.

  • args.Value: Returns the dimension the business rule is assigned to in the data source.

Common Usage

  • Custom parsing logic

  • Field value concatenation

  • Field value bypassing

  • Evaluate field other than current field being parsed

Parser Business Rule Example

Copy

VB.NET

Namespace OneStream.BusinessRule.Parser.XFR_ParseDelimitedTextAndGetField
    Public Class MainClass
        '----------------------------------------------------------------------------------------------------
        ' Reference Code: XFR_ParseDelimitedTextAndGetField
        ' Description:    Parse a delimited string and return a selected field from the delimited list.
        ' Usage:          Parser Business Rule intended to be used on any field within a Data Source.
        '----------------------------------------------------------------------------------------------------
        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As ParserDimension, ByVal args As ParserArgs) As Object
            Try
                ' Parse the line
                Dim fields As List(Of String) = StringHelper.SplitString(args.Line, ",", StageConstants.ParserDefaults.DefaultQuoteCharacter)
                If fields.Count >= 2 Then
                    ' Return the 2nd field (Zero based index)
                    Return fields(1)
                Else
                    ' Line invalid, just return incoming value and let parser engine handle the evaluation
                    Return args.Value
                End If
            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Function
    End Class
End Namespace

Connector Rule

Connector business rules are used to communicate with, collect data from, and drill back to external systems.  These Business Rules are written as Shared Business Rules and applied to a data source.

See the Data Collection Guide for more information on using connectors.

Example API

  • args.ActionType: Returns one of the four available Connector action types.

  • ConnectorActionTypes.GetFieldList: Runs the SQL query to return the available field list to the data source for dimension assignment.

  • ConnectorActionTypes.GetData: Runs the SQL query to retrieve the source data and return it to the Stage based on the Data Source dimension assignment.

  • ConnectorActionTypes.GetDrillBackTypes: Returns a list of the specified drill back types, such as File or Data Grid.

  • ConnectorActionTypes.GetDrillBack: Runs the required SQL query against the source system and provides more detail than what was originally imported.

Connector Business Rule Example

NamespaceOneStream.BusinessRule.Connector.RevenueMgmtHouston
Copy

VB.NET

Public Class MainClass
    Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As Object
        Try
            ' Get the query information
            Dim connectionString As String = GetConnectionString(si, globals, api)

            ' Get the Field name list or load the data
            Select Case args.ActionType
                Case Is = ConnectorActionTypes.GetFieldList
                    ' Return Field Name List
                    Dim fieldListSQL As String = GetFieldListSQL(si, globals, api)
                    Return api.Parser.GetFieldNameListForSQLQuery(si, DbProviderType.OLEDB, connectionString, True, fieldListSQL, False)

                Case Is = ConnectorActionTypes.GetData
                    ' Process Data
                    Dim sourceDataSQL As String = GetSourceDataSQL(si, globals, api)
                    api.Parser.ProcessSQLQuery(si, DbProviderType.OLEDB, connectionString, True, sourceDataSQL, False, api.ProcessInfo)
                    Return Nothing

                Case Is = ConnectorActionTypes.GetDrillBackTypes
                    ' Return the list of Drill Types (Options) to present to the end user
                    Return Me.GetDrillBackTypeList(si, globals, api, args)

                Case Is = ConnectorActionTypes.GetDrillBack
                    ' Process the specific Drill-Back type
                    Return Me.GetDrillBack(si, globals, api, args, args.DrillBackType.DisplayType, connectionString)
            End Select

        Catch ex As Exception
            Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
        End Try
    End Function

    ' Create a Connection string to the External Database
    Private Function GetConnectionString(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer) As String
        Try
            ' Named External Connection in App Server Config
            '-------------------------------------------------------
            Return "RevenueMgmtSystem"

        Catch ex As Exception
            Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
        End Try
    End Function

    ' Create the field list SQL Statement
    Private Function GetFieldListSQL(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer) As String
        Try
            ' Create the SQL Statement
            Dim sql As New Text.StringBuilder

            sql.Append("SELECT Top(1)")
            sql.Append("TransID, PlantCode, CustId, CustName, InvNo, InvYear, InvMonth, InvDesc, GLAccount, WorkDay, ProdModel, BomCode, UnitPrice, Units, Amount, DestinationCode ")

            sql.Append("FROM InvoiceDocumentDetail ")
                        Return sql.ToString

        Catch ex As Exception
            Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
        End Try
    End Function

    ' Create the data load SQL Statement
    Private Function GetSourceDataSQL(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer) As String
        Try
            ' Create the SQL Statement
            Dim statement As New Text.StringBuilder
            Dim selectClause As New Text.StringBuilder
            Dim fromClause As New Text.StringBuilder
            Dim whereClause As New Text.StringBuilder
            Dim orderByClause As New Text.StringBuilder

            selectClause.Append("SELECT ")
            selectClause.Append("TransID, PlantCode, CustId, CustName, InvNo, InvYear, InvMonth, InvDesc, GLAccount, WorkDay, ProdModel, BomCode, UnitPrice, Units, Amount, DestinationCode ")

            fromClause.Append("FROM InvoiceDocumentDetail ")

            whereClause.Append("WHERE ")
            ' Get the YEAR from the current XF Workflow Unit TimeKey
            whereClause.Append("(")
            whereClause.Append("InvYear = " & TimeDimHelper.GetYearFromId(api.WorkflowUnitPk.TimeKey).ToString)
            whereClause.Append(")")

            ' Get the MONTH from the current XF Workflow Unit TimeKey
            whereClause.Append(" And ")
            whereClause.Append("(")
            whereClause.Append("InvMonth = 'M" & TimeDimHelper.GetSubComponentsFromId(api.WorkflowUnitPk.TimeKey).Month.ToString & "'")
            whereClause.Append(") ")

            ' Select Houston Plant Codes
            whereClause.Append(" And ")
            whereClause.Append("(")
            whereClause.Append("PlantCode IN('H200','H210')")
            whereClause.Append(") ")

            orderByClause.Append("ORDER BY ")
            orderByClause.Append("PlantCode, CustId, WorkDay, ProdModel, DestinationCode")

            ' Create the full SQL Statement
            statement.Append(selectClause.ToString)
            statement.Append(fromClause.ToString)
            statement.Append(whereClause.ToString)
            statement.Append(orderByClause.ToString)

            Return statement.ToString

        Catch ex As Exception
            Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
        End Try
    End Function

    ' Create the drill back options list
    Private Function GetDrillBackTypeList(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As List(Of DrillBackTypeInfo)
        Try

Conditional Rule

Conditional rules (mapping) are used to conditionally evaluate mapping criteria during the data transformation process.  These business rules are written as Shared business rules or logical expressions and applied to a transformation rule definition. They are applicable to transformation rules with the type of Composite, Range, List, or Mask either as a business rule or complex expression.

Example APIs

  • args.GetSource: Returns the source value for the specified dimension.

  • args.GetTarget: Returns the mapped or transformed value for the specified dimension.

  • args.OutputValue: Returns the originally mapped target value from the transformation rules.

Conditional Business Rule Example

Example: Conditional rule for dimension member mapping based on source values.

NOTE: If the business rule does not call args.OutputValue, the target field can be empty and will not be considered.

Copy

VB.NET

Namespace OneStream.BusinessRule.ConditionalRule.XFR_Conditional_Source
    Public Class MainClass
        '----------------------------------------------------------------------------------------------------
        ' Reference Code: XFR_Conditional_Source
        ' Description:    Demonstrates how to map a flow Dimension based on the source account.
        ' Usage:          Used for conditional flow Member mapping based on source account.
        '----------------------------------------------------------------------------------------------------
        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConditionalRuleArgs) As Object
            Try
                ' Grab the source account value
                Dim account As String = args.GetSource("A#")

                ' Assign the flow Member based on the source account
                If account.StartsWith("1190") Then
                    Return "Additions"
                Else
                    ' Just return value assigned to the Transformation Rule
                    Return args.OutputValue
                End If

                Return Nothing

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Function
    End Class
End Namespace

Conditional Business Rule Example

Example: Conditional rule for dimension member mapping based on target values.

Copy

VB.NET

Namespace OneStream.BusinessRule.ConditionalRule.XFR_Conditional_Target
    Public Class MainClass
        '----------------------------------------------------------------------------------------------------
        ' Reference Code: XFR_Conditional_Target
        ' Description:    Demonstrates how to map a flow Dimension based on the target account.
        ' Usage:          Used for conditional flow Member mapping based on target account.
        '----------------------------------------------------------------------------------------------------
        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConditionalRuleArgs) As Object
            Try

                ' Grab the target account value
                Dim account As String = args.GetTarget("A#")

                ' Assign the flow Member based on the first character of the target account
                Select Case Left(account, 1)
                    Case "1", "2", "3"
                        Return "End_Inp"
                    Case Else
                        Return "None"
                End Select

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Function
    End Class
End Namespace

Derivative Rule

Derivative rules, which derive data befpre mapping, are used to evaluate or calculate values during the data derivation process. These business rules are written as Shared business rules or logical expressions and applied to a derivative rule definition. They are only applicable to transformation rules with the type of Derivative either as a business rule or complex expression.

Common Usage

  • Calculate mathematical expressions

  • Look up value from transformation cache for use in calculations

  • Look up value from cube for use in calculations

  • Source system check rule logic (validation rules on source data)

Derivative Business Rule Example

Copy

VB.NET

Namespace OneStream.BusinessRule.DerivativeRule.XFR_ExecuteStageCacheQuery
    Public Class MainClass
        '----------------------------------------------------------------------------------------------------
        ' Reference Code: XFR_ExecuteStageCacheQuery
        '
        ' Description:    Retrieves a value from the transformation cache calculated by another derivative rule
        '                 and uses the value as an input to calculate the ratio of one account to another.
        '
        ' Usage:          Derivative Business Rule intended to demonstrate how to retrieve a value from the
        '                 transformation cache and use it as input to a calculation.
        '----------------------------------------------------------------------------------------------------
        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As DerivativeRuleArgs) As Object
            Try
                ' Get Cash Value by querying the cache
                Dim valueCash As Decimal = Decimal.Zero
                Using dtCash As DataTable = api.QueryDataCache(si, "Ac = 'Cash'", False, True)
                    If Not dtCash Is Nothing Then
                        For Each row As DataRow In dtCash.Rows
                            valueCash = row("Am")
                            Exit For
                        Next
                    End If
                End Using

                ' The current value is AR
                Dim valueAR As Decimal = args.ColumnValue

                ' Return the ratio of AR/Cash
                If (valueAR <> Decimal.Zero) And (valueCash <> Decimal.Zero) Then
                    Return (valueAR / valueCash)
                Else
                    ' Just return the value from the Stage
                    Return args.ColumnValue
                End If
                Return Nothing

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Function
    End Class
End Namespace

Cube View Extender

Cube View Extender rules are used to apply advanced Cube View formatting to any Cube View while in report view. 

NOTE: These rules do not apply to Cube View formatting in the data explorer grid view.

The Extender rule is used with the Execute Cube View Extender Business Rule setting on the Cube View. See General Settings.

See the API Overview Guide.

Common Usage

The following are key uses for Cube View Extender business rules in formatting reports.

  • Update headers and footers

    • Display different logos on select reports based on conditional logic or security and manage their placement and size

    • Customize the page number in the header or footer

      NOTE: Page numbers can be on the top or bottom row of a report and the horizontal position can be specified for rows.  This only applies to the top or bottom rows.

    • Format individual header and footer fields

    • Control the left, right, center subtitle widths

    • Control the font size of title and subtitles

    • Customize the date display

  • Update column and row headers

    • Customize bottom text alignment

    • Control word wrap

  • Apply conditional formatting to data cells

    • Format cells based on their contents

    • Change the text color of a value to effectively hide the result

Dashboard DataSet

Dashboard DataSet Rules are used to create programmatic query results  This rule type combines multiple types of data into a single result set using the full syntax capability of VB.Net. These business rules are written as Shared business rules and applied to dashboard data adapters or dashboard parameters.

Common Usage

  • Combine different types of data for a report

  • Build programmatic data queries, for example, analytic plus SQL

  • Conditionally build data query reports

  • Conditionally build data query for parameters

  • Create geographical data to display using a Map parameter component in a dashboard

  • Create a data series to display using a Chart (Advanced) parameter component in a dashboard

Dashboard Extender

Dashboard Extender rules are used to perform a variety of tasks associated with custom dashboards and OneStream Solutions. These business rules are part of multipurpose rules and make up the majority of the code written in a OneStream Solution. In addition, they are written as Shared business rules and applied to application dashboard parameter components, for example, Buttons and Combo Boxes.

Common Usage

  • Runs task when the user selects a button

  • Perform a task and show a message to the user

  • Perform a custom calculation

  • Upload a file from the end user’s machine

  • Automate a workflow

  • Build a custom workflow

  • Create custom data tables

  • Include page state to store parameters and values about a specific dashboard page instance

Dashboard XFBRString

Copy
BRString(brRuleName, funcNameWithinBRRule, optionalName1 = var1, optionalName2 = var2)

Enter the business rule as a parameter using |!BRString!|. The return value from the business rule will be used in the Dashboard component. 

NOTE: This business rule can be applied to any dashboard or Cube View property where a parameter is used.

Extensibility Rule

Extensibility rules include Extender and Event Handlers. Full administrator rights are required to edit these rules.

  • Extender: Most generalized type of business rule. They are used to write a simple utility function or a specific helper function run in a data management job.

  • Event Handlers: Runs logic before or after a certain operation occurs within the system.

Extensibility Business Rule Example

Example: Event Handler that sends an email notification after a ProcessCube event.

Copy

VB.NET

Namespace OneStream.BusinessRule.DataQualityEventHandler.DataQualityEventHandler
    Public Class MainClass
        '----------------------------------------------------------------------------------------------------
        ' Reference Code: DataQualityEventHandler
        '
        ' Description:    Event handler method that provides an opportunity to supplement a normal data
        '                 quality action with your own custom functionality.
        '                 (Example: email after ProcessCube or publish report to SharePoint after
        '                 failed Confirmation).
        '
        ' Usage:          Executes when a Data Quality action is run and fires this Business Rule. If you have
        '                 written code in that handles the specified event operation the code will be executed.
        '----------------------------------------------------------------------------------------------------
        Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DataQualityEventHandlerArgs) As Object
            Try
                ' Define a switch to control event processing, since many of these are reference examples we do not want them to run all the time
                Dim processEvents As Boolean = False

                ' Set the default return values
                Dim returnValue As Object = args.DefaultReturnValue
                args.UseReturnValueFromBusinessRule = False
                args.Cancel = False

                ' Evaluate the operation type in order to determine which subroutine to process
                Select Case args.OperationName
                    Case Is = BREventOperationType.DataQuality.ProcessCube.NoCalculate
                        ' Execute a Data Management job after process Cube runs
                        Me.XFR_HandleProcessCubeNoCalculate(si, globals, api, args)

                    Case Is = BREventOperationType.DataQuality.Certify.FinalizeSetCertifyState
                        ' Send an email after a Workflow Profile executes its certification
                        Me.XFR_HandleFinalizeSetCertifyState(si, globals, api, args)

                End Select

                Return returnValue

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Function

#Region "ProcessCube.NoCalculate Helpers"

        Private Sub XFR_HandleProcessCubeNoCalculate(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DataQualityEventHandlerArgs)
            '----------------------------------------------------------------------------------------------------
            ' Reference Code: XFR_HandleProcessCubeNoCalculate
            '
            ' Description:    Run a Data Management Sequence after the Workflow process Cube task is run.
            '
            '                 Note: the Data Management Sequence name is assigned to a Workflow Profile
            '                 CalcDef filter field so this event does not have to be modified, the user
            '                 can simply edit the CalcDef grid for a Workflow Profile and this Business
            '                 Rule will execute the specified sequence.
            '
            ' Usage:          Used to supplement the standard "ProcessCube" functionality associated
            '                 with a Workflow Profile by allowing a Data Management Sequence to be
            '                 executed for the Workflow Profile as well.
            '----------------------------------------------------------------------------------------------------
            Try
                ' Get the DataUnitInfo from the Event arguments so that we can get the name of the DataManagement sequence to process.
                Dim calcInfo As DataUnitInfo = DirectCast(args.Inputs(2), DataUnitInfo)
                If Not calcInfo Is Nothing Then
                    ' Make sure that a Sequence name as assigned to the filter value of the Calc Definition of the executing Workflow Profile
                    If calcInfo.FilterValue <> String.Empty Then

                        ' Now, execute the DataMgmt Sequence that was specified in the FilterValue (in a background thread)
                        BRApi.Utilities.StartDataMgmtSequence(si, calcInfo.FilterValue, Nothing)

                    End If
                End If

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Sub

#End Region

#Region "FinalizeSetCertifyState Helpers"
        ' Apply tag this to Text1 of users that should be notified when a child Workflow certifies
        Public Const NotifyCertifyCompleted As String = "#NCC"

        Private Sub XFR_HandleFinalizeSetCertifyState(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DataQualityEventHandlerArgs)
            '----------------------------------------------------------------------------------------------------
            ' Reference Code: XFR_HandleFinalizeSetCertifyState
            '
            ' Description:    Send an email to users assigned the Workflow execution group of the Parent
            '                 Workflow Profile of the Workflow Profile that just certified.
            '
            ' Usage:          Used to provide email notification when a dependent Workflow Profile
            '                 certifies.
            '----------------------------------------------------------------------------------------------------
            Try

                ' Check the before / after flag, we want to handle the AFTER event
                If (args.IsBeforeEvent = False) Then

                    ' Check to see if the profile was certified, add send an email all Parents of the certifying profile
                    Dim certifyInstance As CertifyInstanceInfo = DirectCast(args.Inputs(2), CertifyInstanceInfo)
                    If Not certifyInstance Is Nothing Then
                        If certifyInstance.IsCertified(si) Then

                            ' Get the list of users assigned to the Parent of the Workflow profile so that we know who should get an email
                            Dim notificationUsers As List(Of UserInfo) = BRApi.Workflow.General.GetUsersInWorkflowGroupForParents(si, certifyInstance.Workflow.WfUnitPk.CreateWorkflowUnitClusterPk(), SharedConstants.WorkflowProfileAttributeIndexes.WorkflowExecutionGroup, True, True, NotifyCertifyCompleted)
                            For Each userSummary As UserInfo In notificationUsers
                                ' Send the email
                                Me.CreateMessageAndSendMail(si, certifyInstance, userSummary)
                            Next
                        End If

                    End If

                End If

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Sub

        Private Sub CreateMessageAndSendMail(ByVal si As SessionInfo, certInstance As CertifyInstanceInfo, userSummary As UserInfo)
            '----------------------------------------------------------------------------------------------------
            ' Reference Code: CreateMessageAndSendMail
            '
            ' Description:    Create the email message body and execute the "Send Mail" function.
            '----------------------------------------------------------------------------------------------------
            Try
                Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)

                    Dim emailInfo As New Text.StringBuilder
                    emailInfo.AppendLine("To: " & userSummary.User.Email)

                    ' Create the message title
                    Dim messageTitle As New Text.StringBuilder
                    messageTitle.Append("OneStream Workflow [")
                    messageTitle.Append(certInstance.WorkflowProfileName)
                    messageTitle.Append(", ")
                    messageTitle.Append(ScenarioDimHelper.GetNameFromId(dbConnApp, certInstance.Workflow.WfUnitPk.ScenarioKey))
                    messageTitle.Append(", ")

                    messageTitle.Append(TimeDimHelper.GetNameFromId(certInstance.Workflow.WfUnitPk.TimeKey))
                    messageTitle.Append("] is ready for you to review.")
                    messageTitle.AppendLine("")

                    ' Create the message body
                    Dim messageBody As New Text.StringBuilder
                    messageBody.AppendLine("Certification Information:")
                    messageBody.AppendLine("------------------------------------------------------------------")

                    messageBody.AppendLine("Profile Name........ " & certInstance.WorkflowProfileName)

                    Dim signOff As CertifySignOffInstanceInfo = Nothing
                    If certInstance.SignOffsInDescendingTimestampOrder.Count > 0 Then
                        signOff = certInstance.SignOffsInDescendingTimestampOrder(0)
                        messageBody.AppendLine("User Name........... " & signOff.UserName)

                        messageBody.AppendLine("Time Completed...... " & signOff.TimeStamp.ToLocalTime & " Local Time")

                        messageBody.AppendLine("Comments............ " & signOff.Comments)

                    End If
                    messageBody.AppendLine("")

                    messageBody.AppendLine("Dependent Information:")
                    messageBody.AppendLine("------------------------------------------------------------------")

                    For Each relativeInfo As CertifyRelativeInfo In certInstance.Dependants
                        messageBody.AppendLine(relativeInfo.WorkflowProfile.Name & "  (" & relativeInfo.Workflow.GetOverallStatusText("Not Started", "Completed", "Locked", "Running", "") & ")")
                    Next
                    messageBody.AppendLine("")

                    ' Test the email by writing a log message
                    ErrorHandler.LogMessage(si, emailInfo.ToString & vbCrLf & messageTitle.ToString & vbCrLf & messageBody.ToString)

                    ' Send an email message
                    ' Me.SendMail(si, userSummary.User.Email, messageTitle.ToString, messageBody.ToString)

                End Using

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Sub

        Private Sub SendMail(ByVal si As SessionInfo, ByVal userEmailAddress As String, ByVal subject As String, ByVal messageBody As String)
            '----------------------------------------------------------------------------------------------------
            ' Reference Code: SendMail
            '
            ' Description:    Create the mail connection and send.
            '----------------------------------------------------------------------------------------------------

            Try
                ' Prepare the message
                Dim emailConnectionName As String = "Office365Mail"
                Dim toEmail As New List(Of String)
                toEmail.Add("userEmailAddress")
                Dim subject As String = "Subject"
                Dim body As String = "Body"
                Dim attachments As New List(Of String)
                attachments.Add("FileLocationString")

                ' Send the Message
                BRApi.Utilities.SendMail(si, emailConnectionName, toEmail, subject, body, attachments)

            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try
        End Sub

#End Region

    End Class
End Namespace

Extender

This can be used to automate custom tasks, for example, running external scripts, backups, and report publishing.

WCF Event Handler

Enables a direct interaction with the Microsoft Windows Communication Foundation which means it listens to communication between the client and the web server. The rule will intercept the communication, analyze it, and if certain criteria is met, it will run its logic.  This is quite flexible and has a variety of uses, for example, creating, reading, deleting, and updating different types of objects in the system for users in a group or transformation rule changes. For example, a rule can be created to email an auditor about every metadata change as it happens.

Available Operations

Transformation Event Handler

Runs at various points from import through load. These are the available operations:

  • StartParseAndTransForm

  • InitializeTransFormer

  • ParseSourceData

  • LoadDataCacheFromDB

  • ProcessDerivativeRules

  • ProcessTransformationRules

  • DeleteData

  • DeleteRuleHistory

  • WriteTransFormedData

  • SummarizeTransFormedData

  • CreateRuleHistory

  • EndParseAndTransForm

  • FinalizeParseAndTransForm

  • StartRetransForm

  • EndRetransForm

  • FinalizeRetransForm

  • StartClearData

  • EndClearData

  • FinalizeClearData

  • StartValidateTransForm

  • ValidateDimension

  • EndValidateTransForm

  • FinalizeValidateTransForm

  • StartValidateIntersect

  • EndValidateIntersect

  • FinalizeValidateIntersect

  • LoadIntersect

  • StartLoadIntersect

  • EndLoadIntersect

  • FinalizeLoadIntersect

Journals Event Handler

Run before, during, or after a journal operation, for example, submission, approval, or post. These are the available operations:

  • SubmitJournal

  • ApproveJournal

  • RejectJournal

  • PostJournal

  • UnpostJournal

  • StartUpdateJournalWorkflow

  • EndUpdateJournalWorkflow

  • FinalizeUpdateJournalWorkflow

Save Data Event Handler

Run to track all save events in an application.

Forms Event Handler

Run before, during, or after an operation, for example, form save. These are the available operations:

  • SaveForm

  • CompleteForm

  • RevertForm

  • StartUpdateFormWorkflow

  • EndUpdateFormWorkflow

  • FinalizeUpdateFormWorkflow

Data Quality Event Handler

Run before, during, or after data quality events, for example, confirmation and certification. These are the available operations:

  • StartProcessCube

  • Calculate

  • Translate

  • Consolidate

  • EndProcessCube

  • FinalizeProcessCube

  • PrepareICMatch

  • StartICMatch

  • PrepareICMatchData

  • EndICMatch

  • StartConfirm

  • EndConfirm

  • FinalizeConfirm

  • SaveQuestionResponse

  • StartSetQuestionnaireState

  • SaveQuestionnaireState

  • EndSetQuestionnaireState

  • StartSetCertifyState

  • SaveCertifyState

  • EndSetCertifyState

  • FinalizeSetCertifyState

Data Management Event Handler

Run before or after a data management sequence or step runs. These are the available operations:

  • StartSequence

  • ExecuteStep

  • EndSequence

Workflow Event Handler

Run before or after a workflow execution step. These are the available operations:

  • UpdateWorkflowStatus

  • WorkflowLock

  • WorkflowUnlock